Clipboard.Clear
Clipboard.SetText "Hello world!"
MsgBox Clipboard.GetText()
If I do the same thing in VBA (for instance in a SUB), I get error:
"Run-time error '424':
Object required"
The error occurs on line "Clipboard.Clear". I assume this means that
there is no object that refers to the clipboard (as I guess happens
automatically in VB). Is there an easy way to do this in VBA
(specifically in Excel)? All I really want to do is to put the full
path name to the active workbook into the clipboard, so I can past it
into the VFP command window when I'm processing files by hand...
Thanks,
Woody
HTH,
David McRitchie, Microsoft MVP - Excel [alternate/main sites below]
My Excel Macros: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.geocities.com/davemcritchie/excel/search.htm
"Woody" <sugar...@yahoo.com> wrote in message news:ed89da80.01110...@posting.google.com...
The following will demonstrate the correct VBA syntax:
Sub ClipboardDemo(MyStr As String)
Dim DataIn As DataObject, DataOut As DataObject
Set DataIn = New DataObject
Set DataOut = New DataObject
With DataIn
.SetText MyStr
.PutInClipboard
End With
With DataOut
.GetFromClipboard
MsgBox .GetText
End With
End Sub
--
Regards,
Vasant.
"Woody" <sugar...@yahoo.com> wrote in message
news:ed89da80.01110...@posting.google.com...